<?php

use Illuminate\Database\Migrations\Migration;

class Productimagefileattributes extends Migration {

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		// add columns and table
		Schema::create("product_image_type", function($table)
		{
			$table->increments("id");
			$table->string("type");
			
			// soft deletes
			$table->softDeletes();

			// timestamps
			$table->timestamps();
		});

		Schema::create("product_file_type", function($table)
		{
			$table->increments("id");
			$table->string("type");
			
			// soft deletes
			$table->softDeletes();

			// timestamps
			$table->timestamps();
		});
		
		Schema::table('product_images', function($table)
		{
			$table->integer('typeid');
		});

		Schema::table('product_files', function($table)
		{
			$table->integer('typeid');
		});
	}

	/**
	 * Reverse the migrations.
	 *
	 * @return void
	 */
	public function down()
	{
		// remove columns and table
		
		Schema::drop("product_image_type");
		Schema::drop("product_file_type");
		
		Schema::table("product_images", function($table)
		{
			$table->dropColumn("typeid");
		});
		
		Schema::table("product_files", function($table)
		{
			$table->dropColumn("typeid");
		});
		
	}

}